
package com.hmsg.health.dao;

import com.hmsg.health.bean.Dto.TaskDto;
import com.hmsg.health.bean.domain.ShareDo;
import com.hmsg.health.bean.domain.SigninDo;
import com.hmsg.health.bean.domain.TaskDo;
import com.hmsg.health.bean.domain.UserDo;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ShareDao {
	
   
   
    
    
    @Select("<script>" +
    	    "select * from  `t_share` t where 1=1 " +
    	    "    <if test='info.id != null'>" +
    	    "     and t.id = #{info.id} " +
    	    "    </if>" +
    	    "    <if test='info.userId != null'>" +
    	    "      and t.user_id = #{info.userId}  " +
    	    "    </if>" +
    	    "    <if test='info.time != null'>" +
    	    "    	and date_format(t.create_time,'%Y-%m-%d')=#{info.time}" +
    	    "    </if>" +
    	   
    	    "</script>")
    List<ShareDo> select(@Param("info") ShareDo info);
    
    
   
  
    @Insert("<script>" +
    "insert into `t_share` " +
    "  <set>" +
    "    <if test='info.userId != null'>" +
    "     `user_id` = #{info.userId}, " +
    "    </if>" +
  
    "    <if test='info.createTime != null'>" +
    "      `create_time` = #{info.createTime}, " +
    "    </if>" +
    "    <if test='info.glod != null'>" +
    "      `glod` = #{info.glod}" +
    "    </if>" +
 
    "  </set>" +
    "</script>")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	int save(@Param("info") ShareDo info);

}